package cn.com.netedge.iot.frontend.biz.vo;

import java.util.*;

public class DeviceTask {

    private String taskId;

    private Integer taskType;

    private String data;

    private List<String> messageList;

    private Map<Integer, Object> resultMap;

    private Date taskTime;

    private int messageCount;

    private int errorCount;

    private List<Object> itemList;

    public Date getTaskTime() {
        return taskTime;
    }

    public void setTaskTime(Date taskTime) {
        this.taskTime = taskTime;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public Integer getTaskType() {
        return taskType;
    }

    public void setTaskType(Integer taskType) {
        this.taskType = taskType;
    }

    public int getMessageCount() {
        return messageCount;
    }

    public void setMessageCount(int messageCount) {
        this.messageCount = messageCount;
    }

    public void addMessage(String message) {
        if(messageList == null) {
             messageList = new LinkedList<>();
        }
        messageList.add(message);
    }

    public List<String> getMessageList() {
        return messageList;
    }

    public Map<Integer, Object> getResultMap() {
        return resultMap;
    }

    public void addResult(Integer key, Object result) {
        if(resultMap == null ) {
            resultMap = new HashMap<>();
        }
        resultMap.put(key, result);
    }

    public List<Object> getItemList() {
        return itemList;
    }

    public void setMessageList(List<String> messageList) {
        this.messageList = messageList;
    }

    public void setResultMap(Map<Integer, Object> resultMap) {
        this.resultMap = resultMap;
    }

    public void setItemList(List<Object> itemList) {
        this.itemList = itemList;
    }

    public void addItem(Object item) {
        if(itemList == null) {
            itemList = new LinkedList<>();
        }
        itemList.add(item);
    }

    public int getErrorCount() {
        return errorCount;
    }

    public void setErrorCount(int errorCount) {
        this.errorCount = errorCount;
    }

    public void increamentErrorCount() {
        this.errorCount ++;
    }
}
